GIS & Geospatial Data Analysis (Fall 2025)
download.file() download files from an url
[1] "The Project Gutenberg eBook of The History of Sir Charles Grandison, Volume 4 (of 7)"
[2] " "
[3] "This ebook is for the use of anyone anywhere in the United States and"
[4] "most other parts of the world at no cost and with almost no restrictions"
[5] "whatsoever. You may copy it, give it away or re-use it under the terms"
[6] "of the Project Gutenberg License included with this ebook or online"
ggplotWe can define an ggplot object by specifying:
Patterns - use + to introduce more layers or components
Rows: 48
Columns: 25
$ state <chr> "WY", "PA", "OH", "NM", "MD", "RI", "OR", "WI", …
$ division_code <dbl> 8, 2, 3, 8, 5, 1, 9, 3, 4, 8, 5, 2, 7, 4, 4, 8, …
$ division_str <chr> "Mountain", "Middle Atlantic", "East North Centr…
$ political_value_index <dbl> -19.7, 2.0, -0.7, 2.4, 8.5, 11.2, 4.0, 2.4, -10.…
$ median_income <dbl> 4081.5, 4218.0, 2469.0, -2401.5, 19404.5, 8141.0…
$ hs_grad_rate <dbl> 8.3380421, 2.3380421, 3.4380421, -0.6619579, 4.2…
$ college_grad_rate <dbl> -2.1237299, -1.6237299, -2.9237299, -0.5237299, …
$ challenge_count <dbl> 4, 148, 29, 3, 5, 3, 118, 10, 6, 0, 13, 25, 5, 1…
$ explicit_count <dbl> 1, 15, 13, 1, 2, 3, 26, 5, 2, 0, 4, 7, 1, 6, 1, …
$ antifamily_count <dbl> 0, 2, 5, 0, 1, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0, …
$ occult_count <dbl> 0, 3, 2, 0, 0, 0, 3, 1, 0, 0, 0, 1, 1, 1, 0, 0, …
$ language_count <dbl> 0, 16, 14, 1, 3, 2, 14, 3, 2, 0, 7, 9, 3, 5, 1, …
$ lgbtq_count <dbl> 1, 5, 1, 0, 2, 0, 10, 1, 0, 0, 3, 3, 0, 0, 0, 0,…
$ violent_count <dbl> 1, 6, 2, 0, 2, 0, 19, 2, 1, 0, 3, 3, 1, 3, 1, 0,…
$ removed_count <dbl> 1, 11, 10, 2, 0, 1, 5, 3, 2, 0, 4, 11, 0, 10, 0,…
$ removed_pct <dbl> 25.000000, 7.432432, 34.482759, 66.666667, 0.000…
$ POPU_LSA <dbl> 544270, 12054201, 11551941, 1588981, 5633514, 14…
$ POPU_ST <dbl> 544270, 12284183, 11551941, 2009671, 5618344, 10…
$ CENTLIB <dbl> 23, 451, 240, 91, 15, 47, 122, 378, 80, 19, 61, …
$ BRANLIB <dbl> 53, 183, 480, 27, 169, 26, 94, 82, 10, 67, 331, …
$ BKMOB <dbl> 2, 29, 58, 1, 18, 2, 8, 6, 12, 4, 17, 6, 1, 4, 7…
$ BKVOL <dbl> 2497545, 27790282, 45224425, 4518130, 13954140, …
$ LIBRARIA <dbl> 189.16, 1445.81, 2725.65, 290.37, 1297.29, 232.1…
$ VISITS <dbl> 3872783, 47188171, 88255852, 8324986, 33662473, …
$ REGBOR <dbl> 383126, 5549200, 8767349, 1140637, 3271760, 5747…
tigris_vars <- c("STUSPS10", "NAME10", "ALAND10", "AWATER10", "INTPTLAT10", "INTPTLON10")
main_states <- bk_df |> pull(state)
library(tigris)
state_sf <- states(year = 2010, progress_bar = FALSE) |>
select(any_of(tigris_vars)) |>
filter(STUSPS10 %in% main_states)
state_sf |> st_crs() |> print()Coordinate Reference System:
User input: NAD83
wkt:
GEOGCRS["NAD83",
DATUM["North American Datum 1983",
ELLIPSOID["GRS 1980",6378137,298.257222101,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["latitude",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["longitude",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4269]]
| STUSPS10 | NAME10 | ALAND10 | AWATER10 | INTPTLAT10 | INTPTLON10 | division_code | division_str | political_value_index | median_income | hs_grad_rate | college_grad_rate | challenge_count | explicit_count | antifamily_count | occult_count | language_count | lgbtq_count | violent_count | removed_count | removed_pct | POPU_LSA | POPU_ST | CENTLIB | BRANLIB | BKMOB | BKVOL | LIBRARIA | VISITS | REGBOR | geometry |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NY | New York | 122056806947 | 19239924100 | +42.9133974 | -075.5962723 | 2 | Middle Atlantic | 10.2 | 5007.5 | -0.4619579 | 3.37627 | 25 | 7 | 2 | 1 | 9 | 3 | 3 | 11 | 44.00000 | 19121677 | 18976664 | 755 | 311 | 6 | 73077567 | 4062.49 | 117795146 | 10589289 | MULTIPOLYGON (((-74.0394 40… |
| IL | Illinois | 143793362385 | 6202038080 | +40.1028754 | -089.1526108 | 3 | East North Central | 7.7 | 6489.5 | 1.8380421 | 2.07627 | 39 | 16 | 2 | 0 | 9 | 4 | 6 | 12 | 30.76923 | 11802452 | 12830632 | 634 | 161 | 23 | 45333092 | 3113.71 | 83072172 | 5348139 | MULTIPOLYGON (((-90.45081 3… |
Common aesthetic attributes
Tip
labs(): to customize plot labels